import { BasePath } from "@/constant";
import { error, log } from "@/util";
import { writeFile } from "@/util/files";
import path from "path";


/**
 * @description 生成初始配置模板
 */
const generateInitFiles = () => {
    try {
        /** By way of writing, to avoid the permission problems. */
        const templateJSON = require(path.resolve(__dirname, BasePath.Template));
        writeFile('wudongCli.config.json', JSON.stringify(templateJSON, null, 4));
        log('generate wudong.config.json successfully.');
    } catch(e) {
        console.log(e);
        error('generate wudong.config.json failed.');
    }
};

export {
    generateInitFiles
}